package com.wmyg.antifake.gs1.ns2.basic;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dom4j.Attribute;
import org.dom4j.Element;

import java.util.List;

/**
 * @program: antifake
 * @description: 附加信息
 * @author: wong
 * @create: 19-4-23
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class StringAVP {

    private String name;

    private String content;

    public StringAVP(Element element) {
        List<Attribute> attributes = element.attributes();
        if (attributes.size() > 0) {
            this.name = attributes.get(0).getValue();
        }
        this.content = element.getText();
    }

}
